#ifndef MP3CUT_H
#define MP3CUT_H

#include <QtGui/QMainWindow>
#include "ui_mp3cut.h"
#include <Phonon>
#include <QFileDialog>
#include <QString>
#include <QMessageBox>
#include <QTime>
#include <QFile>
#include <QFileInfo>
#include <QLCDNumber>
#include <QDataStream>
#include <QListView>
#include <QModelIndex>
#include <QStringListModel>
#include <QSettings>
#include <QCloseEvent>
#include <QUrl>
#include "cutDialog.h"

const int MAX_FILES = 100;

class lcdMod : public QLCDNumber
{
	Q_OBJECT
public:
	lcdMod(QWidget *parent = 0);
	~lcdMod();
public:
	void mousePressEvent(QMouseEvent *e);
	void hide();
signals:
	void clicked();

};

class mp3cut : public QMainWindow
{
	Q_OBJECT

public:
	mp3cut(QWidget *parent = 0, Qt::WFlags flags = 0);
	~mp3cut();

public:
	Ui::mp3cutClass ui;

public:
	void setup();
	QTime toQtime(qint64 time);
	int toMseconds(QTime time);
	void readSettings();

protected:
	void dragEnterEvent(QDragEnterEvent* e);
	void dropEvent(QDropEvent *e);

public slots:;
	bool playButtonPressed();
	bool stopButtonPressed();
	bool pauseButtonPressed();
	void addFiles();
	void newFile();

	void tick(qint64 time);
	void splitButtonPressed();
	void fileSelected(const QString &a);
	void procesarSplit(int tipo, QString tam);
	void updateTimeLabel();
	void remainingChange();
	void saveFiles();
	

public:
	Phonon::MediaObject *mediaObject;
	Phonon::AudioOutput *audioOutput;
	QFileDialog *fileDialog;
	QList<Phonon::MediaSource> sources;
	QString fileName;
	QString openDirName;
	QString saveDirName;
	QString dirName;
	QFile *file;
	QFileInfo *fileInfo;
	cutDialog *dialog;
	lcdMod lcd;
	QFile *files[MAX_FILES];
	QByteArray *bArray[MAX_FILES];
	QStringListModel *model;
    QStringList list;
	QTime file_time;
	QDir mainDirectory;

private:
	QString actualFileName;
	QSettings *settings;
	

public:
	bool remaining;
	int archivosTotales;

protected:
	void closeEvent(QCloseEvent *event);
};


#endif // MP3CUT_H
